package com.monkeyboy.spring.service;

import com.monkeyboy.spring.model.User;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.Aware;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @Author Gavin
 * @date 2021.02.19 16:17
 */
@Component
public class A implements ApplicationContextAware, InitializingBean {
	@Autowired
//	@Qualifier("b")
	private I c;
	ApplicationContext ac;

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.ac = applicationContext;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("InitializingBean .................");
	}

	@PostConstruct
	public void test() {
		System.out.println("post construct.......................");
	}
}
